<!--
Copyright (C) 2019-2023 Nicola Murino

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, version 3.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
{{template "baselogin" .}}

{{define "title"}}Login{{end}}

{{define "content"}}
                                    <div class="text-center">
                                        <h1 class="h4 text-gray-900 mb-4">{{.Branding.ShortName}}</h1>
                                    </div>
                                    {{if .Error}}
                                    <div class="alert alert-warning alert-dismissible fade show" role="alert">
                                        {{.Error}}
                                        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                                            <span aria-hidden="true">&times;</span>
                                        </button>
                                    </div>
                                    {{end}}
                                    <form id="login_form" action="{{.CurrentURL}}" method="POST"
                                        class="user-custom">
                                        {{if not .FormDisabled}}
                                        <div class="form-group">
                                            <input type="text" class="form-control form-control-user-custom"
                                                id="inputUsername" name="username" placeholder="Username" spellcheck="false" required>
                                        </div>
                                        <div class="form-group">
                                            <input type="password" class="form-control form-control-user-custom"
                                                id="inputPassword" name="password" placeholder="Password" autocomplete="current-password" spellcheck="false" required>
                                            {{if .ForgotPwdURL}}
                                            <div class="text-right">
                                                <a class="small" href="{{.ForgotPwdURL}}">Forgot password?</a>
                                            </div>
                                            {{end}}
                                        </div>
                                        <input type="hidden" name="_form_token" value="{{.CSRFToken}}">
                                        <button type="submit" class="btn btn-primary btn-user-custom btn-block">
                                            Login
                                        </button>
                                        {{end}}
                                        {{if .OpenIDLoginURL}}
                                        <hr>
                                        <a href="{{.OpenIDLoginURL}}" class="btn btn-secondary btn-user-custom btn-block">
                                            Login with OpenID
                                        </a>
                                        {{end}}
                                    </form>
                                    {{if .AltLoginURL}}
                                    <hr>
                                    <div class="text-center">
                                        <a class="small" href="{{.AltLoginURL}}">{{.AltLoginName}}</a>
                                    </div>
                                    {{end}}
                                    {{if and .Branding.DisclaimerName .Branding.DisclaimerPath}}
                                    <hr>
                                    <div class="text-center">
                                        <a class="small" href="{{.StaticURL}}{{.Branding.DisclaimerPath}}" target="_blank">{{.Branding.DisclaimerName}}</a>
                                    </div>
                                    {{end}}
{{end}}